function regExpMatch(url, pattern) {
    try { return new RegExp(pattern).test(url); } catch(ex) { return false; }
}

function FindProxyForURL(url, host) {
    if (shExpMatch(url, '*njut.edu.cn/*')) return 'DIRECT';
    if (shExpMatch(url, '*njtech.edu.cn/*')) return 'DIRECT';
	if (isInNet(host,'127.0.0.0','255.0.0.0')) return 'DIRECT';
    if (isInNet(host, '10.0.0.0','255.0.0.0' ) ) return 'DIRECT';
    if (isInNet(host, '172.16.0.0','255.240.0.0' ) ) return 'DIRECT';
    if (isInNet(host, '192.168.0.0','255.255.0.0' ) ) return 'DIRECT';
    if (isInNet(host,'202.119.240.0','255.255.240.0')) return 'DIRECT';
    if (isInNet(host,'210.28.192.0','255.255.240.0')) return 'DIRECT';
    return 'PROXY 127.0.0.1:8087';
}